import Vue from 'vue'
import Vuex from 'vuex'

import VuexPersist from 'vuex-persist'



Vue.use(Vuex)


const vuexLC = new VuexPersist({
	storage: window.localStorage
})

const store = new Vuex.Store({
	plugins: [vuexLC.plugin],

	//共享数据的位置
	state: {
		count: 100,
		username: ''
	},


	//mutations 操作
	mutations: {
		increment(state) {
			state.count++
		},

		//login
		setUsername(state, username) {
			state.username = username;
		}
	}
});


export default store;